package org.example.frame;
import javax.swing.*;
import java.awt.*;
import org.example.panel.*;
import org.example.panel.userpanel.*;
import org.example.model.*;

/**
 * @author lenovo
 */

public class UserFrame extends JFrame{
    public UserFrame(User user){
        //组件准备
        JTabbedPane tabbedPane = new JTabbedPane();
        ModifyPasswordPanel modifyPassword = new ModifyPasswordPanel(user);
        DeleteUserPanel deleteUser = new DeleteUserPanel(user,this);
        ExitFramePanel exitFrame = new ExitFramePanel(this);
        ReturnFramePanel returnFrame = new ReturnFramePanel(user,this);
        //添加组件
        tabbedPane.add("修改密码",modifyPassword);
        tabbedPane.add("注销用户",deleteUser);
        tabbedPane.add("退出登录",exitFrame);
        tabbedPane.add("返回界面",returnFrame);
        add(new JLabel("当前用户用户名："+user.getUsername()), BorderLayout.NORTH);
        add(tabbedPane,BorderLayout.CENTER);
        //窗口设置
        setTitle("学生成绩管理->用户管理");
        setSize(500,400);
        setLocationRelativeTo(null);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        validate();
    }
}
